package cn.ibizlab.assetmanagement.assetapi.rest;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import com.alibaba.fastjson.JSONObject;
import javax.servlet.ServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.http.HttpStatus;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.util.StringUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.access.prepost.PostAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import cn.ibizlab.assetmanagement.assetapi.dto.*;
import cn.ibizlab.assetmanagement.assetapi.mapping.*;
import cn.ibizlab.assetmanagement.core.plan.domain.EAMPlanLine;
import cn.ibizlab.assetmanagement.core.plan.service.IEAMPlanLineService;
import cn.ibizlab.assetmanagement.core.plan.filter.EAMPlanLineSearchContext;
import cn.ibizlab.assetmanagement.util.annotation.VersionCheck;

@Slf4j
@Api(tags = {"计划步骤" })
@RestController("AssetApi-eamplanline")
@RequestMapping("")
public class EAMPlanLineResource {

    @Autowired
    public IEAMPlanLineService eamplanlineService;

    @Autowired
    @Lazy
    public EAMPlanLineMapping eamplanlineMapping;

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedto),'iBizAssetManagement-EAMPlanLine-Create')")
    @ApiOperation(value = "新建计划步骤", tags = {"计划步骤" },  notes = "新建计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamplanlines")
    @Transactional
    public ResponseEntity<EAMPlanLineDTO> create(@RequestBody EAMPlanLineDTO eamplanlinedto) {
        EAMPlanLine domain = eamplanlineMapping.toDomain(eamplanlinedto);
		eamplanlineService.create(domain);
        EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain);
		return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedtos),'iBizAssetManagement-EAMPlanLine-Create')")
    @ApiOperation(value = "批量新建计划步骤", tags = {"计划步骤" },  notes = "批量新建计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamplanlines/batch")
    public ResponseEntity<Boolean> createBatch(@RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        eamplanlineService.createBatch(eamplanlineMapping.toDomain(eamplanlinedtos));
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @VersionCheck(entity = "eamplanline" , versionfield = "updatedate")
    @PreAuthorize("hasPermission(this.eamplanlineService.get(#eamplanline_id),'iBizAssetManagement-EAMPlanLine-Update')")
    @ApiOperation(value = "更新计划步骤", tags = {"计划步骤" },  notes = "更新计划步骤")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamplanlines/{eamplanline_id}")
    @Transactional
    public ResponseEntity<EAMPlanLineDTO> update(@PathVariable("eamplanline_id") String eamplanline_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
		EAMPlanLine domain  = eamplanlineMapping.toDomain(eamplanlinedto);
        domain .setEamplanlineid(eamplanline_id);
		eamplanlineService.update(domain );
		EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain );
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.getEamplanlineByEntities(this.eamplanlineMapping.toDomain(#eamplanlinedtos)),'iBizAssetManagement-EAMPlanLine-Update')")
    @ApiOperation(value = "批量更新计划步骤", tags = {"计划步骤" },  notes = "批量更新计划步骤")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamplanlines/batch")
    public ResponseEntity<Boolean> updateBatch(@RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        eamplanlineService.updateBatch(eamplanlineMapping.toDomain(eamplanlinedtos));
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.get(#eamplanline_id),'iBizAssetManagement-EAMPlanLine-Remove')")
    @ApiOperation(value = "删除计划步骤", tags = {"计划步骤" },  notes = "删除计划步骤")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamplanlines/{eamplanline_id}")
    @Transactional
    public ResponseEntity<Boolean> remove(@PathVariable("eamplanline_id") String eamplanline_id) {
         return ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.remove(eamplanline_id));
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.getEamplanlineByIds(#ids),'iBizAssetManagement-EAMPlanLine-Remove')")
    @ApiOperation(value = "批量删除计划步骤", tags = {"计划步骤" },  notes = "批量删除计划步骤")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamplanlines/batch")
    public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
        eamplanlineService.removeBatch(ids);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PostAuthorize("hasPermission(this.eamplanlineMapping.toDomain(returnObject.body),'iBizAssetManagement-EAMPlanLine-Get')")
    @ApiOperation(value = "获取计划步骤", tags = {"计划步骤" },  notes = "获取计划步骤")
	@RequestMapping(method = RequestMethod.GET, value = "/eamplanlines/{eamplanline_id}")
    public ResponseEntity<EAMPlanLineDTO> get(@PathVariable("eamplanline_id") String eamplanline_id) {
        EAMPlanLine domain = eamplanlineService.get(eamplanline_id);
        EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain);
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @ApiOperation(value = "获取计划步骤草稿", tags = {"计划步骤" },  notes = "获取计划步骤草稿")
	@RequestMapping(method = RequestMethod.GET, value = "/eamplanlines/getdraft")
    public ResponseEntity<EAMPlanLineDTO> getDraft() {
        return ResponseEntity.status(HttpStatus.OK).body(eamplanlineMapping.toDto(eamplanlineService.getDraft(new EAMPlanLine())));
    }

    @ApiOperation(value = "检查计划步骤", tags = {"计划步骤" },  notes = "检查计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamplanlines/checkkey")
    public ResponseEntity<Boolean> checkKey(@RequestBody EAMPlanLineDTO eamplanlinedto) {
        return  ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.checkKey(eamplanlineMapping.toDomain(eamplanlinedto)));
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedto),'iBizAssetManagement-EAMPlanLine-Save')")
    @ApiOperation(value = "保存计划步骤", tags = {"计划步骤" },  notes = "保存计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamplanlines/save")
    public ResponseEntity<Boolean> save(@RequestBody EAMPlanLineDTO eamplanlinedto) {
        return ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.save(eamplanlineMapping.toDomain(eamplanlinedto)));
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedtos),'iBizAssetManagement-EAMPlanLine-Save')")
    @ApiOperation(value = "批量保存计划步骤", tags = {"计划步骤" },  notes = "批量保存计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamplanlines/savebatch")
    public ResponseEntity<Boolean> saveBatch(@RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        eamplanlineService.saveBatch(eamplanlineMapping.toDomain(eamplanlinedtos));
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMPlanLine-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMPlanLine-Get')")
	@ApiOperation(value = "获取DEFAULT", tags = {"计划步骤" } ,notes = "获取DEFAULT")
    @RequestMapping(method= RequestMethod.GET , value="/eamplanlines/fetchdefault")
	public ResponseEntity<List<EAMPlanLineDTO>> fetchDefault(EAMPlanLineSearchContext context) {
        Page<EAMPlanLine> domains = eamplanlineService.searchDefault(context) ;
        List<EAMPlanLineDTO> list = eamplanlineMapping.toDto(domains.getContent());
        return ResponseEntity.status(HttpStatus.OK)
                .header("x-page", String.valueOf(context.getPageable().getPageNumber()))
                .header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
                .header("x-total", String.valueOf(domains.getTotalElements()))
                .body(list);
	}

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMPlanLine-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMPlanLine-Get')")
	@ApiOperation(value = "查询DEFAULT", tags = {"计划步骤" } ,notes = "查询DEFAULT")
    @RequestMapping(method= RequestMethod.POST , value="/eamplanlines/searchdefault")
	public ResponseEntity<Page<EAMPlanLineDTO>> searchDefault(@RequestBody EAMPlanLineSearchContext context) {
        Page<EAMPlanLine> domains = eamplanlineService.searchDefault(context) ;
	    return ResponseEntity.status(HttpStatus.OK)
                .body(new PageImpl(eamplanlineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
	}
    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedto),'iBizAssetManagement-EAMPlanLine-Create')")
    @ApiOperation(value = "根据维护计划建立计划步骤", tags = {"计划步骤" },  notes = "根据维护计划建立计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamplans/{eamplan_id}/eamplanlines")
    @Transactional
    public ResponseEntity<EAMPlanLineDTO> createByEAMPlan(@PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        EAMPlanLine domain = eamplanlineMapping.toDomain(eamplanlinedto);
        domain.setEamplanid(eamplan_id);
		eamplanlineService.create(domain);
        EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain);
		return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedtos),'iBizAssetManagement-EAMPlanLine-Create')")
    @ApiOperation(value = "根据维护计划批量建立计划步骤", tags = {"计划步骤" },  notes = "根据维护计划批量建立计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamplans/{eamplan_id}/eamplanlines/batch")
    public ResponseEntity<Boolean> createBatchByEAMPlan(@PathVariable("eamplan_id") String eamplan_id, @RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        List<EAMPlanLine> domainlist=eamplanlineMapping.toDomain(eamplanlinedtos);
        for(EAMPlanLine domain:domainlist){
            domain.setEamplanid(eamplan_id);
        }
        eamplanlineService.createBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @VersionCheck(entity = "eamplanline" , versionfield = "updatedate")
    @PreAuthorize("hasPermission(this.eamplanlineService.get(#eamplanline_id),'iBizAssetManagement-EAMPlanLine-Update')")
    @ApiOperation(value = "根据维护计划更新计划步骤", tags = {"计划步骤" },  notes = "根据维护计划更新计划步骤")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamplans/{eamplan_id}/eamplanlines/{eamplanline_id}")
    @Transactional
    public ResponseEntity<EAMPlanLineDTO> updateByEAMPlan(@PathVariable("eamplan_id") String eamplan_id, @PathVariable("eamplanline_id") String eamplanline_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        EAMPlanLine domain = eamplanlineMapping.toDomain(eamplanlinedto);
        domain.setEamplanid(eamplan_id);
        domain.setEamplanlineid(eamplanline_id);
		eamplanlineService.update(domain);
        EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain);
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.getEamplanlineByEntities(this.eamplanlineMapping.toDomain(#eamplanlinedtos)),'iBizAssetManagement-EAMPlanLine-Update')")
    @ApiOperation(value = "根据维护计划批量更新计划步骤", tags = {"计划步骤" },  notes = "根据维护计划批量更新计划步骤")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamplans/{eamplan_id}/eamplanlines/batch")
    public ResponseEntity<Boolean> updateBatchByEAMPlan(@PathVariable("eamplan_id") String eamplan_id, @RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        List<EAMPlanLine> domainlist=eamplanlineMapping.toDomain(eamplanlinedtos);
        for(EAMPlanLine domain:domainlist){
            domain.setEamplanid(eamplan_id);
        }
        eamplanlineService.updateBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.get(#eamplanline_id),'iBizAssetManagement-EAMPlanLine-Remove')")
    @ApiOperation(value = "根据维护计划删除计划步骤", tags = {"计划步骤" },  notes = "根据维护计划删除计划步骤")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamplans/{eamplan_id}/eamplanlines/{eamplanline_id}")
    @Transactional
    public ResponseEntity<Boolean> removeByEAMPlan(@PathVariable("eamplan_id") String eamplan_id, @PathVariable("eamplanline_id") String eamplanline_id) {
		return ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.remove(eamplanline_id));
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.getEamplanlineByIds(#ids),'iBizAssetManagement-EAMPlanLine-Remove')")
    @ApiOperation(value = "根据维护计划批量删除计划步骤", tags = {"计划步骤" },  notes = "根据维护计划批量删除计划步骤")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamplans/{eamplan_id}/eamplanlines/batch")
    public ResponseEntity<Boolean> removeBatchByEAMPlan(@RequestBody List<String> ids) {
        eamplanlineService.removeBatch(ids);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PostAuthorize("hasPermission(this.eamplanlineMapping.toDomain(returnObject.body),'iBizAssetManagement-EAMPlanLine-Get')")
    @ApiOperation(value = "根据维护计划获取计划步骤", tags = {"计划步骤" },  notes = "根据维护计划获取计划步骤")
	@RequestMapping(method = RequestMethod.GET, value = "/eamplans/{eamplan_id}/eamplanlines/{eamplanline_id}")
    public ResponseEntity<EAMPlanLineDTO> getByEAMPlan(@PathVariable("eamplan_id") String eamplan_id, @PathVariable("eamplanline_id") String eamplanline_id) {
        EAMPlanLine domain = eamplanlineService.get(eamplanline_id);
        EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain);
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @ApiOperation(value = "根据维护计划获取计划步骤草稿", tags = {"计划步骤" },  notes = "根据维护计划获取计划步骤草稿")
    @RequestMapping(method = RequestMethod.GET, value = "/eamplans/{eamplan_id}/eamplanlines/getdraft")
    public ResponseEntity<EAMPlanLineDTO> getDraftByEAMPlan(@PathVariable("eamplan_id") String eamplan_id) {
        EAMPlanLine domain = new EAMPlanLine();
        domain.setEamplanid(eamplan_id);
        return ResponseEntity.status(HttpStatus.OK).body(eamplanlineMapping.toDto(eamplanlineService.getDraft(domain)));
    }

    @ApiOperation(value = "根据维护计划检查计划步骤", tags = {"计划步骤" },  notes = "根据维护计划检查计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamplans/{eamplan_id}/eamplanlines/checkkey")
    public ResponseEntity<Boolean> checkKeyByEAMPlan(@PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        return  ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.checkKey(eamplanlineMapping.toDomain(eamplanlinedto)));
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedto),'iBizAssetManagement-EAMPlanLine-Save')")
    @ApiOperation(value = "根据维护计划保存计划步骤", tags = {"计划步骤" },  notes = "根据维护计划保存计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamplans/{eamplan_id}/eamplanlines/save")
    public ResponseEntity<Boolean> saveByEAMPlan(@PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        EAMPlanLine domain = eamplanlineMapping.toDomain(eamplanlinedto);
        domain.setEamplanid(eamplan_id);
        return ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.save(domain));
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedtos),'iBizAssetManagement-EAMPlanLine-Save')")
    @ApiOperation(value = "根据维护计划批量保存计划步骤", tags = {"计划步骤" },  notes = "根据维护计划批量保存计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamplans/{eamplan_id}/eamplanlines/savebatch")
    public ResponseEntity<Boolean> saveBatchByEAMPlan(@PathVariable("eamplan_id") String eamplan_id, @RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        List<EAMPlanLine> domainlist=eamplanlineMapping.toDomain(eamplanlinedtos);
        for(EAMPlanLine domain:domainlist){
             domain.setEamplanid(eamplan_id);
        }
        eamplanlineService.saveBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMPlanLine-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMPlanLine-Get')")
	@ApiOperation(value = "根据维护计划获取DEFAULT", tags = {"计划步骤" } ,notes = "根据维护计划获取DEFAULT")
    @RequestMapping(method= RequestMethod.GET , value="/eamplans/{eamplan_id}/eamplanlines/fetchdefault")
	public ResponseEntity<List<EAMPlanLineDTO>> fetchEAMPlanLineDefaultByEAMPlan(@PathVariable("eamplan_id") String eamplan_id,EAMPlanLineSearchContext context) {
        context.setN_eamplanid_eq(eamplan_id);
        Page<EAMPlanLine> domains = eamplanlineService.searchDefault(context) ;
        List<EAMPlanLineDTO> list = eamplanlineMapping.toDto(domains.getContent());
	    return ResponseEntity.status(HttpStatus.OK)
                .header("x-page", String.valueOf(context.getPageable().getPageNumber()))
                .header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
                .header("x-total", String.valueOf(domains.getTotalElements()))
                .body(list);
	}

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMPlanLine-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMPlanLine-Get')")
	@ApiOperation(value = "根据维护计划查询DEFAULT", tags = {"计划步骤" } ,notes = "根据维护计划查询DEFAULT")
    @RequestMapping(method= RequestMethod.POST , value="/eamplans/{eamplan_id}/eamplanlines/searchdefault")
	public ResponseEntity<Page<EAMPlanLineDTO>> searchEAMPlanLineDefaultByEAMPlan(@PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineSearchContext context) {
        context.setN_eamplanid_eq(eamplan_id);
        Page<EAMPlanLine> domains = eamplanlineService.searchDefault(context) ;
	    return ResponseEntity.status(HttpStatus.OK)
                .body(new PageImpl(eamplanlineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
	}
    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedto),'iBizAssetManagement-EAMPlanLine-Create')")
    @ApiOperation(value = "根据资产维护计划建立计划步骤", tags = {"计划步骤" },  notes = "根据资产维护计划建立计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines")
    @Transactional
    public ResponseEntity<EAMPlanLineDTO> createByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        EAMPlanLine domain = eamplanlineMapping.toDomain(eamplanlinedto);
        domain.setEamplanid(eamplan_id);
		eamplanlineService.create(domain);
        EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain);
		return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedtos),'iBizAssetManagement-EAMPlanLine-Create')")
    @ApiOperation(value = "根据资产维护计划批量建立计划步骤", tags = {"计划步骤" },  notes = "根据资产维护计划批量建立计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/batch")
    public ResponseEntity<Boolean> createBatchByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        List<EAMPlanLine> domainlist=eamplanlineMapping.toDomain(eamplanlinedtos);
        for(EAMPlanLine domain:domainlist){
            domain.setEamplanid(eamplan_id);
        }
        eamplanlineService.createBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @VersionCheck(entity = "eamplanline" , versionfield = "updatedate")
    @PreAuthorize("hasPermission(this.eamplanlineService.get(#eamplanline_id),'iBizAssetManagement-EAMPlanLine-Update')")
    @ApiOperation(value = "根据资产维护计划更新计划步骤", tags = {"计划步骤" },  notes = "根据资产维护计划更新计划步骤")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/{eamplanline_id}")
    @Transactional
    public ResponseEntity<EAMPlanLineDTO> updateByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @PathVariable("eamplanline_id") String eamplanline_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        EAMPlanLine domain = eamplanlineMapping.toDomain(eamplanlinedto);
        domain.setEamplanid(eamplan_id);
        domain.setEamplanlineid(eamplanline_id);
		eamplanlineService.update(domain);
        EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain);
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.getEamplanlineByEntities(this.eamplanlineMapping.toDomain(#eamplanlinedtos)),'iBizAssetManagement-EAMPlanLine-Update')")
    @ApiOperation(value = "根据资产维护计划批量更新计划步骤", tags = {"计划步骤" },  notes = "根据资产维护计划批量更新计划步骤")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/batch")
    public ResponseEntity<Boolean> updateBatchByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        List<EAMPlanLine> domainlist=eamplanlineMapping.toDomain(eamplanlinedtos);
        for(EAMPlanLine domain:domainlist){
            domain.setEamplanid(eamplan_id);
        }
        eamplanlineService.updateBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.get(#eamplanline_id),'iBizAssetManagement-EAMPlanLine-Remove')")
    @ApiOperation(value = "根据资产维护计划删除计划步骤", tags = {"计划步骤" },  notes = "根据资产维护计划删除计划步骤")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/{eamplanline_id}")
    @Transactional
    public ResponseEntity<Boolean> removeByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @PathVariable("eamplanline_id") String eamplanline_id) {
		return ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.remove(eamplanline_id));
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.getEamplanlineByIds(#ids),'iBizAssetManagement-EAMPlanLine-Remove')")
    @ApiOperation(value = "根据资产维护计划批量删除计划步骤", tags = {"计划步骤" },  notes = "根据资产维护计划批量删除计划步骤")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/batch")
    public ResponseEntity<Boolean> removeBatchByEAMAssetEAMPlan(@RequestBody List<String> ids) {
        eamplanlineService.removeBatch(ids);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PostAuthorize("hasPermission(this.eamplanlineMapping.toDomain(returnObject.body),'iBizAssetManagement-EAMPlanLine-Get')")
    @ApiOperation(value = "根据资产维护计划获取计划步骤", tags = {"计划步骤" },  notes = "根据资产维护计划获取计划步骤")
	@RequestMapping(method = RequestMethod.GET, value = "/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/{eamplanline_id}")
    public ResponseEntity<EAMPlanLineDTO> getByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @PathVariable("eamplanline_id") String eamplanline_id) {
        EAMPlanLine domain = eamplanlineService.get(eamplanline_id);
        EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain);
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @ApiOperation(value = "根据资产维护计划获取计划步骤草稿", tags = {"计划步骤" },  notes = "根据资产维护计划获取计划步骤草稿")
    @RequestMapping(method = RequestMethod.GET, value = "/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/getdraft")
    public ResponseEntity<EAMPlanLineDTO> getDraftByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id) {
        EAMPlanLine domain = new EAMPlanLine();
        domain.setEamplanid(eamplan_id);
        return ResponseEntity.status(HttpStatus.OK).body(eamplanlineMapping.toDto(eamplanlineService.getDraft(domain)));
    }

    @ApiOperation(value = "根据资产维护计划检查计划步骤", tags = {"计划步骤" },  notes = "根据资产维护计划检查计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/checkkey")
    public ResponseEntity<Boolean> checkKeyByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        return  ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.checkKey(eamplanlineMapping.toDomain(eamplanlinedto)));
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedto),'iBizAssetManagement-EAMPlanLine-Save')")
    @ApiOperation(value = "根据资产维护计划保存计划步骤", tags = {"计划步骤" },  notes = "根据资产维护计划保存计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/save")
    public ResponseEntity<Boolean> saveByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        EAMPlanLine domain = eamplanlineMapping.toDomain(eamplanlinedto);
        domain.setEamplanid(eamplan_id);
        return ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.save(domain));
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedtos),'iBizAssetManagement-EAMPlanLine-Save')")
    @ApiOperation(value = "根据资产维护计划批量保存计划步骤", tags = {"计划步骤" },  notes = "根据资产维护计划批量保存计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/savebatch")
    public ResponseEntity<Boolean> saveBatchByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        List<EAMPlanLine> domainlist=eamplanlineMapping.toDomain(eamplanlinedtos);
        for(EAMPlanLine domain:domainlist){
             domain.setEamplanid(eamplan_id);
        }
        eamplanlineService.saveBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMPlanLine-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMPlanLine-Get')")
	@ApiOperation(value = "根据资产维护计划获取DEFAULT", tags = {"计划步骤" } ,notes = "根据资产维护计划获取DEFAULT")
    @RequestMapping(method= RequestMethod.GET , value="/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/fetchdefault")
	public ResponseEntity<List<EAMPlanLineDTO>> fetchEAMPlanLineDefaultByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id,EAMPlanLineSearchContext context) {
        context.setN_eamplanid_eq(eamplan_id);
        Page<EAMPlanLine> domains = eamplanlineService.searchDefault(context) ;
        List<EAMPlanLineDTO> list = eamplanlineMapping.toDto(domains.getContent());
	    return ResponseEntity.status(HttpStatus.OK)
                .header("x-page", String.valueOf(context.getPageable().getPageNumber()))
                .header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
                .header("x-total", String.valueOf(domains.getTotalElements()))
                .body(list);
	}

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMPlanLine-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMPlanLine-Get')")
	@ApiOperation(value = "根据资产维护计划查询DEFAULT", tags = {"计划步骤" } ,notes = "根据资产维护计划查询DEFAULT")
    @RequestMapping(method= RequestMethod.POST , value="/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/searchdefault")
	public ResponseEntity<Page<EAMPlanLineDTO>> searchEAMPlanLineDefaultByEAMAssetEAMPlan(@PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineSearchContext context) {
        context.setN_eamplanid_eq(eamplan_id);
        Page<EAMPlanLine> domains = eamplanlineService.searchDefault(context) ;
	    return ResponseEntity.status(HttpStatus.OK)
                .body(new PageImpl(eamplanlineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
	}
    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedto),'iBizAssetManagement-EAMPlanLine-Create')")
    @ApiOperation(value = "根据功能位置资产维护计划建立计划步骤", tags = {"计划步骤" },  notes = "根据功能位置资产维护计划建立计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines")
    @Transactional
    public ResponseEntity<EAMPlanLineDTO> createByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        EAMPlanLine domain = eamplanlineMapping.toDomain(eamplanlinedto);
        domain.setEamplanid(eamplan_id);
		eamplanlineService.create(domain);
        EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain);
		return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedtos),'iBizAssetManagement-EAMPlanLine-Create')")
    @ApiOperation(value = "根据功能位置资产维护计划批量建立计划步骤", tags = {"计划步骤" },  notes = "根据功能位置资产维护计划批量建立计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/batch")
    public ResponseEntity<Boolean> createBatchByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        List<EAMPlanLine> domainlist=eamplanlineMapping.toDomain(eamplanlinedtos);
        for(EAMPlanLine domain:domainlist){
            domain.setEamplanid(eamplan_id);
        }
        eamplanlineService.createBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @VersionCheck(entity = "eamplanline" , versionfield = "updatedate")
    @PreAuthorize("hasPermission(this.eamplanlineService.get(#eamplanline_id),'iBizAssetManagement-EAMPlanLine-Update')")
    @ApiOperation(value = "根据功能位置资产维护计划更新计划步骤", tags = {"计划步骤" },  notes = "根据功能位置资产维护计划更新计划步骤")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/{eamplanline_id}")
    @Transactional
    public ResponseEntity<EAMPlanLineDTO> updateByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @PathVariable("eamplanline_id") String eamplanline_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        EAMPlanLine domain = eamplanlineMapping.toDomain(eamplanlinedto);
        domain.setEamplanid(eamplan_id);
        domain.setEamplanlineid(eamplanline_id);
		eamplanlineService.update(domain);
        EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain);
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.getEamplanlineByEntities(this.eamplanlineMapping.toDomain(#eamplanlinedtos)),'iBizAssetManagement-EAMPlanLine-Update')")
    @ApiOperation(value = "根据功能位置资产维护计划批量更新计划步骤", tags = {"计划步骤" },  notes = "根据功能位置资产维护计划批量更新计划步骤")
	@RequestMapping(method = RequestMethod.PUT, value = "/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/batch")
    public ResponseEntity<Boolean> updateBatchByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        List<EAMPlanLine> domainlist=eamplanlineMapping.toDomain(eamplanlinedtos);
        for(EAMPlanLine domain:domainlist){
            domain.setEamplanid(eamplan_id);
        }
        eamplanlineService.updateBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.get(#eamplanline_id),'iBizAssetManagement-EAMPlanLine-Remove')")
    @ApiOperation(value = "根据功能位置资产维护计划删除计划步骤", tags = {"计划步骤" },  notes = "根据功能位置资产维护计划删除计划步骤")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/{eamplanline_id}")
    @Transactional
    public ResponseEntity<Boolean> removeByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @PathVariable("eamplanline_id") String eamplanline_id) {
		return ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.remove(eamplanline_id));
    }

    @PreAuthorize("hasPermission(this.eamplanlineService.getEamplanlineByIds(#ids),'iBizAssetManagement-EAMPlanLine-Remove')")
    @ApiOperation(value = "根据功能位置资产维护计划批量删除计划步骤", tags = {"计划步骤" },  notes = "根据功能位置资产维护计划批量删除计划步骤")
	@RequestMapping(method = RequestMethod.DELETE, value = "/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/batch")
    public ResponseEntity<Boolean> removeBatchByEAMLocationEAMAssetEAMPlan(@RequestBody List<String> ids) {
        eamplanlineService.removeBatch(ids);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PostAuthorize("hasPermission(this.eamplanlineMapping.toDomain(returnObject.body),'iBizAssetManagement-EAMPlanLine-Get')")
    @ApiOperation(value = "根据功能位置资产维护计划获取计划步骤", tags = {"计划步骤" },  notes = "根据功能位置资产维护计划获取计划步骤")
	@RequestMapping(method = RequestMethod.GET, value = "/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/{eamplanline_id}")
    public ResponseEntity<EAMPlanLineDTO> getByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @PathVariable("eamplanline_id") String eamplanline_id) {
        EAMPlanLine domain = eamplanlineService.get(eamplanline_id);
        EAMPlanLineDTO dto = eamplanlineMapping.toDto(domain);
        return ResponseEntity.status(HttpStatus.OK).body(dto);
    }

    @ApiOperation(value = "根据功能位置资产维护计划获取计划步骤草稿", tags = {"计划步骤" },  notes = "根据功能位置资产维护计划获取计划步骤草稿")
    @RequestMapping(method = RequestMethod.GET, value = "/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/getdraft")
    public ResponseEntity<EAMPlanLineDTO> getDraftByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id) {
        EAMPlanLine domain = new EAMPlanLine();
        domain.setEamplanid(eamplan_id);
        return ResponseEntity.status(HttpStatus.OK).body(eamplanlineMapping.toDto(eamplanlineService.getDraft(domain)));
    }

    @ApiOperation(value = "根据功能位置资产维护计划检查计划步骤", tags = {"计划步骤" },  notes = "根据功能位置资产维护计划检查计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/checkkey")
    public ResponseEntity<Boolean> checkKeyByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        return  ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.checkKey(eamplanlineMapping.toDomain(eamplanlinedto)));
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedto),'iBizAssetManagement-EAMPlanLine-Save')")
    @ApiOperation(value = "根据功能位置资产维护计划保存计划步骤", tags = {"计划步骤" },  notes = "根据功能位置资产维护计划保存计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/save")
    public ResponseEntity<Boolean> saveByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineDTO eamplanlinedto) {
        EAMPlanLine domain = eamplanlineMapping.toDomain(eamplanlinedto);
        domain.setEamplanid(eamplan_id);
        return ResponseEntity.status(HttpStatus.OK).body(eamplanlineService.save(domain));
    }

    @PreAuthorize("hasPermission(this.eamplanlineMapping.toDomain(#eamplanlinedtos),'iBizAssetManagement-EAMPlanLine-Save')")
    @ApiOperation(value = "根据功能位置资产维护计划批量保存计划步骤", tags = {"计划步骤" },  notes = "根据功能位置资产维护计划批量保存计划步骤")
	@RequestMapping(method = RequestMethod.POST, value = "/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/savebatch")
    public ResponseEntity<Boolean> saveBatchByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody List<EAMPlanLineDTO> eamplanlinedtos) {
        List<EAMPlanLine> domainlist=eamplanlineMapping.toDomain(eamplanlinedtos);
        for(EAMPlanLine domain:domainlist){
             domain.setEamplanid(eamplan_id);
        }
        eamplanlineService.saveBatch(domainlist);
        return  ResponseEntity.status(HttpStatus.OK).body(true);
    }

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMPlanLine-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMPlanLine-Get')")
	@ApiOperation(value = "根据功能位置资产维护计划获取DEFAULT", tags = {"计划步骤" } ,notes = "根据功能位置资产维护计划获取DEFAULT")
    @RequestMapping(method= RequestMethod.GET , value="/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/fetchdefault")
	public ResponseEntity<List<EAMPlanLineDTO>> fetchEAMPlanLineDefaultByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id,EAMPlanLineSearchContext context) {
        context.setN_eamplanid_eq(eamplan_id);
        Page<EAMPlanLine> domains = eamplanlineService.searchDefault(context) ;
        List<EAMPlanLineDTO> list = eamplanlineMapping.toDto(domains.getContent());
	    return ResponseEntity.status(HttpStatus.OK)
                .header("x-page", String.valueOf(context.getPageable().getPageNumber()))
                .header("x-per-page", String.valueOf(context.getPageable().getPageSize()))
                .header("x-total", String.valueOf(domains.getTotalElements()))
                .body(list);
	}

    @PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','iBizAssetManagement-EAMPlanLine-searchDefault-all') and hasPermission(#context,'iBizAssetManagement-EAMPlanLine-Get')")
	@ApiOperation(value = "根据功能位置资产维护计划查询DEFAULT", tags = {"计划步骤" } ,notes = "根据功能位置资产维护计划查询DEFAULT")
    @RequestMapping(method= RequestMethod.POST , value="/eamlocations/{eamlocation_id}/eamassets/{eamasset_id}/eamplans/{eamplan_id}/eamplanlines/searchdefault")
	public ResponseEntity<Page<EAMPlanLineDTO>> searchEAMPlanLineDefaultByEAMLocationEAMAssetEAMPlan(@PathVariable("eamlocation_id") String eamlocation_id, @PathVariable("eamasset_id") String eamasset_id, @PathVariable("eamplan_id") String eamplan_id, @RequestBody EAMPlanLineSearchContext context) {
        context.setN_eamplanid_eq(eamplan_id);
        Page<EAMPlanLine> domains = eamplanlineService.searchDefault(context) ;
	    return ResponseEntity.status(HttpStatus.OK)
                .body(new PageImpl(eamplanlineMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
	}
}

